<%@ page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<%request.setCharacterEncoding("UTF-8"); %>
<jsp:useBean id="user" class="cn.User"></jsp:useBean>
<jsp:setProperty property="*" name="user"></jsp:setProperty>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=uft-8">
    
    <title>处理注册页面</title>
   

  </head>
  
  <body>
    <br>
 

   <% 
   String driver = "com.mysql.jdbc.Driver";  
   String url = "jdbc:mysql://localhost:3306/jsp";  
   String use = "root";   
   String password = "root"; 
    Class.forName(driver);  
    Connection conn= DriverManager.getConnection(url,use,password);  
    
    String sql="insert into user(username,password) values(?,?)";
    PreparedStatement ps =conn.prepareStatement(sql);
    ps.setString(1,user.getUsername());
    ps.setInt(2,user.getPassword());
    int row=ps.executeUpdate();
    if(row>0){
    	out.print("成功注册！");
    	
    }

	  ps.close();
	    conn.close();
   %>
<a href="success.jsp">here</a>
  </body>
</html>